package com.ruoyi.wisdom.task;

import com.ruoyi.wisdom.constants.IotConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class IotTask {

    @Autowired
    @Qualifier("redisTemplate")
    public RedisTemplate redisTemplate;

    @Autowired
    @Qualifier("redisSecondTemplate")
    public RedisTemplate redisSecondTemplate;

    @Autowired
    public IotConstants iotConstants;

    // 输出日志
    public Boolean echoLog = true;

    // 输出错误日志
    public Boolean echoErrorLog = true;

    /**
     * 打印日志
     *
     * @param msg
     */
    public void printLog(String msg) {
        if (echoLog) log.info(msg);
    }

    /**
     * 打印错误日志
     *
     * @param msg
     */
    public void printErrorLog(String msg) {
        if (echoErrorLog) log.error(msg);
    }
}
